package com.example.computer_exam_training_sys.controller;

import com.example.computer_exam_training_sys.service.QuestionPreviewDTOService;
import com.example.computer_exam_training_sys.service.QuestionService;
import com.example.computer_exam_training_sys.vo.QuestionPreviewDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/questionpreview")
@CrossOrigin
public class QuestionPreviewDTOController {
    @Autowired
    private QuestionPreviewDTOService questionPreviewDTOService;


    // 根据试卷id联查所有题目
    // 访问路径:  http://localhost:8080/questionpreview/preview?paper_id=13
    @GetMapping("/preview")
    public List<QuestionPreviewDTO> preview(@RequestParam Integer paper_id) {
        return questionPreviewDTOService.getPreviewByPaperId(paper_id);
    }

}
